home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 441 / vdisrc12 / vdioutp3.s < prev    next >
Text File  |  1990-11-23  |  5KB  |  122 lines

  1.  
  2. ;*========================================================================
  3. ;*
  4. ;* VDIFAST Public Domain VDI bindings.
  5. ;*
  6. ;*========================================================================
  7.           
  8.           .iif      !(^^macdef VContrl),.include  "vdimacro.s"
  9.           
  10. ;*************************************************************************
  11. ;*
  12. ;* Text output functions.
  13. ;*
  14. ;*************************************************************************
  15.  
  16. ;*------------------------------------------------------------------------
  17. ;*-----------------------------------------------------------------------
  18. ;* vstr_stack.
  19. ;*  For VDI text functions that need the string stacked into intin.
  20. ;*  Entry:  a0.l -> string
  21. ;*  Exit:   a0.l -> stacked integerized (ADE) string
  22. ;*          d0.w  = stack words used (intin count)
  23. ;*      d1,d2,a1  = Trashed by this routine.
  24. ;*-----------------------------------------------------------------------
  25. ;*------------------------------------------------------------------------
  26.  
  27. vstr_stack:
  28.           move.l    (sp)+,a1            ;* Save return address.
  29.           moveq.l   #0,d0               ;* Zero out string length counter.
  30. .strcnt:                                ;* Count up length of string...
  31.           tst.b     (a0)+               ;* Found end yet?
  32.           beq.s     .strend             ;* Yep, go integerize it.
  33.           addq.w    #1,d0               ;* Nope, add 1 to counter,
  34.           bra.s     .strcnt             ;* and keep looking.
  35. .strend:
  36.           move.w    d0,d1               ;* Prime loop counter.
  37.           moveq.l   #0,d2               ;* Nice clean register.
  38. .strcpy:                                ;* Copy the string to the stack,
  39.           move.b    -(a0),d2            ;* with each string byte in the
  40.           move.w    d2,-(sp)            ;* low byte of each stack word,
  41.           dbra      d1,.strcpy          ;* which is how VDI likes to see it.
  42.           
  43.           move.l    sp,a0               ;* Save pointer to stacked string.
  44.           jmp       (a1)                ;* Return to caller.
  45.           
  46. ;*------------------------------------------------------------------------
  47. ;* Text.
  48. ;*------------------------------------------------------------------------
  49.  
  50. _v_gtext::
  51.  
  52.           .cargs    #8,.handle.w,.x.w,.y.w,.p_str.l
  53.           link      a6,#0
  54.           
  55.           move.l    .p_str(a6),a0       ;* Get the string pointer.
  56.           bsr       vstr_stack          ;* Go integerize and stack string.
  57.           
  58.           VContrl   #8,,#1,d0
  59.           
  60.           subq.l    #8,sp               ;* -> ptsout
  61.           pea       .x(a6)              ;* -> ptsin
  62.           move.l    a0,-(sp)            ;* -> intin
  63.           pea       16(sp)              ;* -> contrl
  64.  
  65.           jmp       vdicall
  66.           
  67. ;*------------------------------------------------------------------------
  68. ;* Justified text. 
  69. ;*------------------------------------------------------------------------
  70.  
  71. _v_justified::
  72.  
  73.           .cargs    #8,.handle.w,.x.w,.y.w,.p_str.l,.length.w,.wspace.w,.cspace.w
  74.           link      a6,#0
  75.           
  76.           move.l    .p_str(a6),a0       ;* Get the string pointer.
  77.           bsr       vstr_stack          ;* Go integerize and stack string.
  78.           
  79.           move.w    .cspace(a6),-(sp)   ;* The character and word spacing
  80.           move.w    .wspace(a6),-(sp)   ;* flags are the 1st 2 intin words.
  81.           addq.w    #2,d0               ;* Count the 2 extra words in length.
  82.           move.l    sp,a0               ;* Save pointer to intin.
  83.           
  84.           clr.w     -(sp)               ;* Build the ptsin array on the stack,
  85.           move.w    .length(a6),-(sp)   ;* because it has an extra null word
  86.           move.l    .x(a6),-(sp)        ;* after the x/y/length.
  87.           move.l    sp,a1               ;* Save pointer to ptsin.
  88.           
  89.           VContrl   #11,#10,#2,d0
  90.           
  91.           subq.l    #8,sp               ;* -> ptsout
  92.           move.l    a1,-(sp)            ;* -> ptsin
  93.           move.l    a0,-(sp)            ;* -> intin
  94.           pea       16(sp)              ;* -> contrl
  95.  
  96.           jmp       vdicall
  97.  
  98. ;*------------------------------------------------------------------------
  99. ;* Cursor addressable alpha text (VDI escape function 12).
  100. ;*------------------------------------------------------------------------
  101.  
  102. _v_curtext:
  103.  
  104.           .cargs    #8,.handle.w,.p_str.l
  105.           link      a6,#0
  106.           
  107.           move.l    .p_str(a6),a0       ;* Get the string pointer.
  108.           bsr       vstr_stack          ;* Go integerize and stack string.
  109.           move.l    sp,a0               ;* Save pointer to intin.
  110.           
  111.           VContrl   #5,#12,,d0
  112.           
  113.           lea       -12(sp),sp
  114.           move.l    a0,-(sp)            ;* -> intin
  115.           pea       16(sp)              ;* -> contrl
  116.  
  117.           jmp       vdicall
  118.           
  119. ;         end of code.
  120.  
  121.  
  122.